#ifndef TRIANGLETREEMODEL_H
#define TRIANGLETREEMODEL_H

#include <QTreeWidget>
#include "geometrydata.h"
#include "datastructures.h"
#include <QDoubleSpinBox>
#include <QComboBox>

class TriangleTreeModel:QObject
{
Q_OBJECT
public:


    TriangleTreeModel(QTreeWidget *tw);
    void set(Triangle *tr);
public slots:
    void p1xChanged(double);
    void p1yChanged(double);
    void p1paramChanged(double);
    void p2xChanged(double);
    void p2yChanged(double);
    void p2paramChanged(double);
    void p3xChanged(double);
    void p3yChanged(double);
    void p3paramChanged(double);
    void trgparamChanged(double);

    void edge12Changed(int);
    void edge23Changed(int);
    void edge31Changed(int);


private:
    Triangle *trg;
    QTreeWidgetItem *topLevelItem;

    QTreeWidgetItem *pointsItem;

    QTreeWidgetItem *p1item;
    QTreeWidgetItem *p1xitem;
    QTreeWidgetItem *p1yitem;
    QTreeWidgetItem *p1paramitem;

    QTreeWidgetItem *p2item;
    QTreeWidgetItem *p2xitem;
    QTreeWidgetItem *p2yitem;
    QTreeWidgetItem *p2paramitem;

    QTreeWidgetItem *p3item;
    QTreeWidgetItem *p3xitem;
    QTreeWidgetItem *p3yitem;
    QTreeWidgetItem *p3paramitem;

    QTreeWidgetItem *trgparamitem;

    QTreeWidgetItem *edgesitem;
    QTreeWidgetItem *edge12item;
    QTreeWidgetItem *edge23item;
    QTreeWidgetItem *edge31item;

    QDoubleSpinBox *p1xwidget;
    QDoubleSpinBox *p1ywidget;
    QDoubleSpinBox *p1paramwidget;

    QDoubleSpinBox *p2xwidget;
    QDoubleSpinBox *p2ywidget;
    QDoubleSpinBox *p2paramwidget;

    QDoubleSpinBox *p3xwidget;
    QDoubleSpinBox *p3ywidget;
    QDoubleSpinBox *p3paramwidget;


    QComboBox *edge12widget;
    QComboBox *edge23widget;
    QComboBox *edge31widget;

    QDoubleSpinBox *trgparamwidget;
};

#endif // TRIANGLETREEMODEL_H
